<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<jsp:include page="../../../common/head.jsp">
			 <jsp:param name="_spPage" value="true"/>
			 <jsp:param name="_useCalendar" value="true"/>
			 <jsp:param name="_useTab" value="true"/>
		</jsp:include>

		<title>消息模板管理</title>
		<script language="JavaScript">
			//当前页不显示消息通知
			_doNotShowMessageNotice = true;
			$(document).ready(function()
			{
				xjTabs.initTab();
			});
		    function addMessage()
			{
				window.location.href="${ctx}/jsp/system/message/add_message.jsp";
			}
		    function updMessage(messageId){
			    window.location.href="updateMessage.do?messageId="+messageId;
		    } 
		    //批量删除
		    function delBatchMessage(){
			    var str = xjCommon.getValueStr("messageId",",");
				if(str!="")
				{
					if(confirm("确认删除所选内容？"))
					{
						window.top.bottomFrame.listNmMessage();
						document.form1.action="deleteBatchMessage.do?type=收件箱删除";
						document.form1.submit();
					}
				}
				else
					alert("请选择要删除的消息！");
		    }
		    //设置为已读
		    function readBatchMessage(){
			    var str = xjCommon.getValueStr("messageId",",");
				if(str!="")
				{
					if(confirm("确认将所选内容设置为已读？"))
					{
						var returnVal = ModalWindow("jump.do?path=updateReadBatchMessage.do&messageId="+str,640,480);
					    if(returnVal=="ok")
					    {
					    	window.top.bottomFrame.listNmMessage();
					    	xjSpPage.spPageSubmit();
					    }
					}
				}
				else
					alert("请选择要操作的消息！");
		    }
			function delMessage(messageId){
				if(confirm("确认删除所选消息？"))
				{
				    var returnVal = ModalWindow("jump.do?path=delMessage.do&type=收件箱删除&messageId="+messageId,640,480);
				    if(returnVal=="ok")
				    {
				    	window.top.bottomFrame.listNmMessage();
				    	xjSpPage.spPageSubmit();
				    }
				}
			}
		</script>
	</head>
	<body>
	<form action="listMessage.do" name="form1" id="form1" method="post">
	<div id="body_div">
	<w:ShowTitle name="收件箱管理">
	<w:TitleButton funcName="发消息" onClickFunction="addMessage()" urlImg="${ctx}/images/main/add.png"/>
	<w:TitleButton funcName="删除" onClickFunction="delBatchMessage()" urlImg="${ctx}/images/main/delete.png"/>
	<w:TitleButton funcName="设为已读" onClickFunction="readBatchMessage()" urlImg="${ctx}/images/main/update.png"/>
	</w:ShowTitle>
	<div id="body_content">
					<div class="Sliding_tab">
		            <ul>
			           <li></li><li><span class="tabsLink" id="setTab0" link="listMessage.do" type="jump">收信箱</span></li><li></li>
			           <li></li><li><span class="tabsLink" id="setTab1" link="listDraftMessage.do" type="jump">草稿箱</span></li><li></li>
			           <li></li><li><span class="tabsLink" id="setTab2" link="listSendMessage.do" type="jump">发信箱</span></li><li></li>
		            </ul>
	                </div>
	        <div id="content0" class="tabContent">
				<table width="100%">
					<tr>
						<td class="td_title" width="50"><span onClick="xjCommon.checkAll('messageId');">全选</span></td>
						<td class="td_title" width="50">状态</td>
						<td class="td_title" width="150">主题</td>
						<td width="#" class="td_title">内容</td>
						<td width="150" class="td_title">消息来源</td>
						<td class="td_title" width="150">发送时间</td>
						<td class="td_title" width="150">操作</td>
					</tr>
					<c:forEach items="${datalist}" var="obj">
						<tr>
							<td><input type="checkbox" name="messageId" value="${obj.sysMessage.messageId}"/></td>
							<td>${obj.sysMessageReceive.receiveState}</td>
							<td>${obj.sysMessage.messageTitle}</td>
							<td>${obj.sysMessage.messageContent}</td>
							<td>${obj.sysMessage.createUserName}</td>
							<td><fmt:formatDate value="${obj.sysMessage.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
							<td>
							<a href="#" onclick="updMessage('${obj.sysMessage.messageId}')">查看</a>&nbsp;
							<a href="#" onclick="delMessage('${obj.sysMessage.messageId}')">删除</a>
							</td>
						</tr>
					</c:forEach>
				</table>
				<w:spPage />
	        </div>
			</div>
		</div>	
		</form>
	</body>
</html>